﻿namespace WMS6.Web.Inventory
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class LotAttributeQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlAttr01;
        protected DropDownList ddlAttr02;
        protected DropDownList ddlAttri03;
        protected DropDownList ddlAttri04;
        protected DropDownList ddlAttri05;
        protected DropDownList ddlAttri06;
        protected DropDownList ddlAttri07;
        protected DropDownList ddlAttri08;
        protected DropDownList ddlAttri09;
        protected DropDownList ddlAttri10;
        protected DropDownList ddlExpiryDateOper;
        protected DropDownList ddlExternalLotIDOper;
        protected DropDownList ddlLotIDOper;
        protected DropDownList ddlOwnerIDOper;
        protected DropDownList ddlProductDateOper;
        protected DropDownList ddlReceiptDate;
        protected DropDownList ddlSkuIDOper;
        protected DropDownList ddlVendorID;
        protected HtmlForm F5070;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlImage img1;
        protected HtmlImage img2;
        protected HtmlImage img3;
        protected Label lblAttr01;
        protected Label lblAttr02;
        protected Label lblAttri03;
        protected Label lblAttri04;
        protected Label lblAttri05;
        protected Label lblAttri06;
        protected Label lblAttri07;
        protected Label lblAttri08;
        protected Label lblAttri09;
        protected Label lblAttri10;
        protected Label lblExpiryDate;
        protected Label lblExternalLotID;
        protected Label lblLotAttribute;
        protected Label lblLotID;
        protected Label lblOwnerID;
        protected Label lblProductDate;
        protected Label lblReceiptDate;
        protected Label lblSkuID;
        protected Label lblVendorID;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtAttr01;
        protected TextBox txtAttr02;
        protected TextBox txtAttri03;
        protected TextBox txtAttri04;
        protected TextBox txtAttri05;
        protected TextBox txtAttri06;
        protected TextBox txtAttri07;
        protected TextBox txtAttri08;
        protected TextBox txtAttri09;
        protected TextBox txtAttri10;
        protected TextBox txtExpiryDate;
        protected TextBox txtExpiryDate2;
        protected TextBox txtExternalLotID;
        protected TextBox txtLotID;
        protected TextBox txtOwnerID;
        protected TextBox txtProductDate;
        protected TextBox txtProductDate2;
        protected TextBox txtReceiptDate;
        protected TextBox txtReceiptDate2;
        protected TextBox txtSkuID;
        protected TextBox txtVendorID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LotAttributeList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("LotAttributeList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlOwnerIDOper, 0);
            base.InitQueryDDL(this.ddlSkuIDOper, 0);
            base.InitQueryDDL(this.ddlLotIDOper, 0);
            base.InitQueryDDL(this.ddlExternalLotIDOper, 0);
            base.InitQueryDDL(this.ddlAttr01, 0);
            base.InitQueryDDL(this.ddlAttr02, 0);
            base.InitQueryDDL(this.ddlAttri03, 0);
            base.InitQueryDDL(this.ddlAttri04, 0);
            base.InitQueryDDL(this.ddlAttri05, 0);
            base.InitQueryDDL(this.ddlAttri06, 0);
            base.InitQueryDDL(this.ddlAttri07, 0);
            base.InitQueryDDL(this.ddlAttri08, 0);
            base.InitQueryDDL(this.ddlAttri09, 0);
            base.InitQueryDDL(this.ddlAttri10, 0);
            base.InitQueryDDL(this.ddlProductDateOper, 1);
            base.InitQueryDDL(this.ddlExpiryDateOper, 1);
            base.InitQueryDDL(this.ddlVendorID, 0);
            base.InitQueryDDL(this.ddlReceiptDate, 1);
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnExport.Visible = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.InitDropDownLists();
            }
        }

        public string Attribute01
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttr01.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttr01.Text.Trim(), this.ddlAttr01.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute02
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttr02.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttr02.Text.Trim(), this.ddlAttr02.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute03
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri03.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri03.Text.Trim(), this.ddlAttri03.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute04
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri04.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri04.Text.Trim(), this.ddlAttri04.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute05
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri05.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri05.Text.Trim(), this.ddlAttri05.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute06
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri06.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri06.Text.Trim(), this.ddlAttri06.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute07
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri07.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri07.Text.Trim(), this.ddlAttri07.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute08
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri08.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri08.Text.Trim(), this.ddlAttri07.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute09
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri09.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri09.Text.Trim(), this.ddlAttri09.SelectedValue);
                }
                return "";
            }
        }

        public string Attribute10
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtAttri10.Text.Trim()))
                {
                    return base.GetParamsString(this.txtAttri10.Text.Trim(), this.ddlAttri10.SelectedValue);
                }
                return "";
            }
        }

        public string ExpiryDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExpiryDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExpiryDate.Text.Trim(), this.ddlExpiryDateOper.SelectedValue, this.txtExpiryDate2.Text.Trim(), "ExpiryDate");
                }
                return "";
            }
        }

        public string ExternalLotID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalLotID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalLotID.Text.Trim(), this.ddlExternalLotIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string LotID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLotID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLotID.Text.Trim(), this.ddlLotIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string ProductDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtProductDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtProductDate.Text.Trim(), this.ddlProductDateOper.SelectedValue, this.txtProductDate2.Text.Trim(), "ProductDate");
                }
                return "";
            }
        }

        public string ReceiptDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceiptDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceiptDate.Text.Trim(), this.ddlReceiptDate.SelectedValue, this.txtReceiptDate2.Text.Trim(), "ReceiptDate");
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }
    }
}

